package ar.uba.dc.cmovil.tripplanner.utils;

import android.app.Activity;
import android.content.Intent;
import android.provider.CalendarContract;

import ar.uba.dc.cmovil.tripplanner.domain.Place;

/**
 * Created by anton on 10/17/13.
 */
public class PlaceUtils {

    public static void addToCalendar(Activity activity, Place place) {
        Intent intent = new Intent(Intent.ACTION_INSERT)
                .setData(CalendarContract.Events.CONTENT_URI)
                .putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, place.getArrivalDate().getTime())
                .putExtra(CalendarContract.Events.TITLE, "Visitando " + place.getName())
                .putExtra(CalendarContract.Events.DESCRIPTION, "Visitando " + place.getName())
                .putExtra(CalendarContract.Events.EVENT_LOCATION, place.getName());
        activity.startActivity(intent);
    }
}
